<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Dart : Libraries : box2d : CanvasViewportTransform</title>
</head>

<body>

<header></header>

<h1 id="title">class <a name='CanvasViewportTransform::CanvasViewportTransform'>CanvasViewportTransform</a></h1>

<section id="inheritance">

<section class="supertype">
<h2>Supertype:</h2>
<ul><li>Object</li></ul>
</section>

<section class="interfaces">
<h2>Implemented interfaces:</h2>
<ul>
<li><a href='IViewportTransform.html#IViewportTransform::IViewportTransform'>IViewportTransform</a></li>
</ul>
</section>

</section>

<section id="summary">

 Transform for drawing using a canvas context. Y-flip is permenantly set
 to true.
</section>

<section id="fields">
<h2>Fields</h2>
<dl>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::DEFAULT_DRAWING_SCALE'>DEFAULT_DRAWING_SCALE
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::center'>center
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::extents'>extents
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='num.html#num::num'>num</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::scale'>scale
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::translation'>translation
</a></code></span>
</dt>
<dd>

 The current translation is the difference in canvas units between the
 actual center of the canvas and the currently specified center. For
 example, if the actual canvas center is (5, 5) but the current center is
 (6, 6), the translation is (1, 1).
</dd>
<dt>
<span class="field-type"><code><code><a href='bool.html#bool::bool'>bool</a></code></code></span>
<span class="field-name"><code><a name='CanvasViewportTransform::yFlip'>yFlip
</a></code></span>
</dt>
<dd>

 Whether the y axis should be flipped such that y is greater as you get
 lower on the screen.
</dd>
</dl>
</section>

<section id="constructors">
<h2>Constructors</h2>
<dl>
<dt>
<code><a href='CanvasViewportTransform.html#CanvasViewportTransform::CanvasViewportTransform'>CanvasViewportTransform</a>(<code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::::extents'>extents</a>, <code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::::center'>center</a>)</code>
</dt>
<dd>

 Constructs a new viewport transform with the default scale.
</dd>
</dl>
</section>

<section id="methods">
<h2>Methods</h2>
<dl>
<dt>
<code>void <a name='CanvasViewportTransform::getScreenToWorld'>getScreenToWorld</a>(<code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::getScreenToWorld::argScreen'>argScreen</a>, <code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::getScreenToWorld::argWorld'>argWorld</a>)</code></dt>
<dd>

 Takes the screen coordinates (argScreen) and puts the
 corresponding world coordinates in argWorld. It should be safe
 to give the same object as both parameters.
</dd>
<dt>
<code>void <a name='CanvasViewportTransform::getWorldToScreen'>getWorldToScreen</a>(<code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::getWorldToScreen::argWorld'>argWorld</a>, <code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='CanvasViewportTransform::getWorldToScreen::argScreen'>argScreen</a>)</code></dt>
<dd>

 Takes the world coordinate (argWorld) puts the corresponding
 screen coordinate in argScreen.  It should be safe to give the
 same object as both parameters.
</dd>
<dt>
<code>void <a name='CanvasViewportTransform::setCamera'>setCamera</a>(<code><a href='num.html#num::num'>num</a></code> <a name='CanvasViewportTransform::setCamera::x'>x</a>, <code><a href='num.html#num::num'>num</a></code> <a name='CanvasViewportTransform::setCamera::y'>y</a>, <code><a href='num.html#num::num'>num</a></code> <a name='CanvasViewportTransform::setCamera::s'>s</a>)</code></dt>
<dd>

 Sets the transform's center to the given x and y coordinates,
 and using the given scale.
</dd>
<dt>
<code>void <a name='CanvasViewportTransform::updateTransformation'>updateTransformation</a>(<code><a href='CanvasRenderingContext2D.html#CanvasRenderingContext2D::CanvasRenderingContext2D'>CanvasRenderingContext2D</a></code> <a name='CanvasViewportTransform::updateTransformation::ctx'>ctx</a>)</code></dt>
<dd>

 Sets the rendering context such that all drawing commands given in terms
 of the world coordinate system will display correctly on the canvas screen.
</dd>
</dl>
</section>

<footer></footer>

</body></html>
